﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class Repcyd_Cydyb : System.Web.UI.Page
{
    string strApp = "";
    string repType = "月报";
    public static string repName = "";
    public string bmp = "";

    BLL.BLLRep br = new BLLRep();

    protected void Page_Load(object sender, EventArgs e)
    {

        if (Request.QueryString["repName"].ToString() == "cyd")
        {
            repName = "厂用电报表";
            bmp = "cydyb.bmp";
        }
        else if (Request.QueryString["repName"].ToString() == "zh")
        {
            repName = "综合报表";
            bmp = "zhzbyb.bmp";
        }
        else if (Request.QueryString["repName"].ToString() == "gl")
        {
            repName = "锅炉报表";
            bmp = "glzbyb.bmp";
        }
        else if (Request.QueryString["repName"].ToString() == "qj")
        {
            repName = "汽机报表";
            bmp = "qjzbyb.bmp";

        }

        if (!IsPostBack)
        {
            DateTime dt = System.DateTime.Now;

            this.Date1.Value = dt.AddMonths(0).ToString("yyyy-MM");

            strApp = br.RetTableByMonth(repName, repType, DateTime.Parse(this.Date1.Value));

            this.show.InnerHtml = strApp;
        }
    }

    protected void btnChaXun_Click(object sender, EventArgs e)
    {
        DateTime dtInput = Convert.ToDateTime(this.Date1.Value);

        strApp = br.RetTableByMonth(repName, repType, dtInput);

        this.show.InnerHtml = strApp;
    }

    protected void btnPre_Click(object sender, EventArgs e)
    {
        //Response.Write("Pre");

        DateTime dtInput = Convert.ToDateTime(this.Date1.Value).AddMonths(-1);

        this.Date1.Value = Convert.ToDateTime(this.Date1.Value).AddMonths(-1).ToString("yyyy-MM");

        strApp = br.RetTableByMonth(repName, repType, dtInput);

        this.show.InnerHtml = strApp;
    }

    protected void btnNext_Click(object sender, EventArgs e)
    {
        //Response.Write("Next");
        DateTime dtInput = Convert.ToDateTime(this.Date1.Value).AddMonths(+1);

        this.Date1.Value = Convert.ToDateTime(this.Date1.Value).AddMonths(+1).ToString("yyyy-MM");

        strApp = br.RetTableByMonth(repName, repType, dtInput);

        this.show.InnerHtml = strApp;
    }
}
